﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace QuanLyThuNgan
{
    public class FeentMstDAO    
    {
        public string m_Insert_( string sobn, string ngay, string sohs, decimal sotien, string GhiChuUni, int idbacsi, string madvpk, string ChanDoanUni, int IDLoaiPhieu, string ghichu, string chandoan, int IDNguoiNhap,string sonhapvien)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_FeentMst_Insert '{0}','{1}','{2}',{3},N'{4}',{5},'{6}',N'{7}',{8},N'{9}',N'{10}',{11},'{12}'",
            sobn, ngay, sohs, sotien,  GhiChuUni, idbacsi, madvpk, ChanDoanUni,  IDLoaiPhieu,ghichu, chandoan,IDNguoiNhap,sonhapvien);
            return _sql;
        }
        public string m_Update_(string sobn, string ngay, string sohs, decimal sotien, string GhiChuUni, int idbacsi, string madvpk, string ChanDoanUni, int IDLoaiPhieu, string ghichu, string chandoan, int IDNguoiNhap, string sonhapvien)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_FeentMst_Update '{0}','{1}','{2}',{3},N'{4}',{5},'{6}',N'{7}',{8},N'{9}',N'{10}',{11},'{12}'",
            sobn, ngay, sohs, sotien, GhiChuUni, idbacsi, madvpk, ChanDoanUni, IDLoaiPhieu, ghichu, chandoan, IDNguoiNhap, sonhapvien);
            return _sql;
        }
        public string m_Delete_(string sobn)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_FeentMst_Delete '{0}'", sobn);
            return _sql;
        }     
  
        public DataTable m_STT_SoBN_IDThuNgan_noitru(int idnguoinhap, string ngay, string madonvi, string maphkham)//madv don vi thu tien,  Madonvi: ma don vi ra chi dinh cam lam sang 
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_SBN_IDCaThuNgan_ISTT_noitru {0},'{1}','{2}','{3}'", idnguoinhap, ngay, madonvi, maphkham);
            return Uit.it_SQL.getDataTable(_sql);
        }

        public DataSet m_LoadDSPhieuNhapTrucTiep_noitru(string mangsbn)
        {
            if (mangsbn.Length == 4)
                mangsbn = "'('''')'";
            string _sql = string.Format("exec dbo.usp_ThuNgan_LoadDanhSachPhieuDichVu_NoiTru {0}", mangsbn);
            return Uit.it_SQL.getDataSet(_sql, true);

        }
    
        public object m_SoBN_KO_CLS_noitru(int loaiphieu, string maphkham)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_SOBN_noitru {0},'{1}'", loaiphieu, maphkham);
            return Uit.it_SQL.ExecuteScalar(_sql, null);

        }
        public string m_Update_mst(string chuoi)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_FeentMst_UpdateTuDong {0}", chuoi);
            return _sql;
        }
        public string m_Delete_group(string loai,string sobn)
        {
            string _sql = string.Format("exec dbo.usp_ThuNgan_FeentMst_Delete_group '{0}','{1}'", loai,sobn);
            return _sql;
        }
        public string m_Update_TraThuoc(string sobn, decimal sotien)
        {
            return string.Format("exec dbo.usp_ThuNgan_Feentmst_Update_TraThuoc '{0}',{1}", sobn, sotien);
        }
    }
}
